/**
 * Created by XianTao on 2016/11/9
 * <p/>
 * Copyright (c) 2015-2015
 * Apache License
 * Version 2.0, January 2004
 * http://www.apache.org/licenses/
 */
package org.lego.handle.exception;

import java.security.InvalidParameterException;

public class ExtraInvalidParameterException extends InvalidParameterException {
    public static final String SEPARATOR_FOR_PARAMS = ":";
    protected String message;

    public ExtraInvalidParameterException(String msgKey, String... params) {
        this.message = generateMsgKey(msgKey, params);
    }

    private String generateMsgKey(String msgKey, String... params) {
        StringBuilder sb = new StringBuilder();
        for (String param : params) {
            sb.append(param).append(SEPARATOR_FOR_PARAMS);
        }
        sb.append(msgKey);
        return sb.toString();
    }

    public String getMessage() {
        return this.message;
    }
}
